#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int n;
    scanf("%d", &n);
    long long sum = 36;
    long long* ans = (long long*)malloc(n * sizeof(long long));
    ans[0] = 6;
    for (int i = 1;i < n;i++)
    {
        ans[i] = 0;
    }
    for (int i = 1;i < n;i++)
    {
        ans[i] += ans[i - 1] * 10 + 6;
        sum += ans[i] * ans[i];
    }
    printf("%lld", sum);
    free(ans);
    return 0;
}